/* the example on page 92 */

#include <gtk/gtk.h>
/* 准备材料，自定义函数  */
	/*  comments注释  */

/* 程序主体 */
int main( int argc, char *argv[] )
{
	GtkWidget *window;
	/* 声明变量window为构件gtkwidget */
	GtkWidget *hbox;
	GtkWidget *frame1;
	GtkWidget *image1;
	GtkWidget *frame2;
	GtkWidget *image2;
	GtkWidget *frame3;
	GtkWidget *image3;
	GtkWidget *frame4;
	GtkWidget *image4;
	GtkWidget *frame5;
	GtkWidget *image5;

	gtk_init (&argc, &argv);
	/* 初始化gtk */

	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	/*  创建顶级窗口 */
	gtk_window_set_title (GTK_WINDOW (window), "水电站hydroelectric  station");
	/*  为窗口顶部加上标题为水电站hydroelectric  station  */
	g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (gtk_main_quit), NULL);
	/*  为窗口加上动作，当收到destroy信号，就启动gtk_main_quit事件，gtk_main_quit就是鼠标单击窗口右上角的关闭按钮就终止程序  */
	gtk_container_set_border_width (GTK_CONTAINER (window), 50);
	/*  简单的理解是将窗口变成容器，可以装入其它构件，构件边缘与窗口边缘的距离为50像数  */

	hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
	/*  创建组合框  */
	gtk_container_add (GTK_CONTAINER (window), hbox);
	/*  将组合框装入窗口容器  */
	
	frame1 = gtk_frame_new ("向家坝水电站");
	/*  创建框架frame1带标签名为向家坝水电站  */
	gtk_frame_set_label_align (GTK_FRAME (frame1), 0, 0);
	/*  设置框架的标签位置在左上角是0,0   中间是0.5,0   右上角是1,0  */
	gtk_frame_set_shadow_type (GTK_FRAME (frame1), GTK_SHADOW_IN);
	/*  设置框架的立体效果为下沉  */
	image1 = gtk_image_new_from_file("./hydroelectric01.jpeg");
	/*  从文件中读取图片，page92.c与hydroelectric01.jpeg要在同一个文件夹，./表示在当前文件夹  */
	gtk_container_add (GTK_CONTAINER (frame1), image1);
	/*  将图片装入框架容器中，框架本身就是容器  */
	gtk_box_pack_start (GTK_BOX (hbox), frame1, FALSE, FALSE, 10);
	/*  将框架装入组合框容器中，数字10表示构件frame1的边缘与hbox的边缘为10像数  */
	
	frame2 = gtk_frame_new ("乌东德水电站");
	gtk_frame_set_label_align (GTK_FRAME (frame2), 0, 0);
	gtk_frame_set_shadow_type (GTK_FRAME (frame2), GTK_SHADOW_OUT);
	/*  设置框架的立体效果为上浮  */
	image2 = gtk_image_new_from_file("./hydroelectric02.jpeg");
	gtk_container_add (GTK_CONTAINER (frame2), image2);
	gtk_box_pack_start (GTK_BOX (hbox), frame2, FALSE, FALSE, 10);
	
	frame3 = gtk_frame_new ("白鹤滩水电站");
	gtk_frame_set_label_align (GTK_FRAME (frame3), 0.5, 0);
	gtk_frame_set_shadow_type (GTK_FRAME (frame3), GTK_SHADOW_IN);
	image3 = gtk_image_new_from_file("./hydroelectric03.jpeg");
	gtk_container_add (GTK_CONTAINER (frame3), image3);
	gtk_box_pack_start (GTK_BOX (hbox), frame3, FALSE, FALSE, 10);

	frame4 = gtk_frame_new ("溪洛渡水电站");
	gtk_frame_set_label_align (GTK_FRAME (frame4), 1, 0);
	gtk_frame_set_shadow_type (GTK_FRAME (frame4), GTK_SHADOW_OUT);
	image4 = gtk_image_new_from_file("./hydroelectric04.jpeg");
	gtk_container_add (GTK_CONTAINER (frame4), image4);
	gtk_box_pack_start (GTK_BOX (hbox), frame4, FALSE, FALSE, 10);

	frame5 = gtk_frame_new ("三峡水电站");
	gtk_frame_set_label_align (GTK_FRAME (frame5), 1, 0);
	gtk_frame_set_shadow_type (GTK_FRAME (frame5), GTK_SHADOW_NONE);
	image5 = gtk_image_new_from_file("./hydroelectric05.jpeg");
	gtk_container_add (GTK_CONTAINER (frame5), image5);
	gtk_box_pack_start (GTK_BOX (hbox), frame5, FALSE, FALSE, 10);

	gtk_widget_show_all (window);
	/*  显示构件窗口包括所有构件  */
	gtk_main ();
	/*  进入主循环，等待信号（鼠标键盘）输入  */
	return 0;
}
/* gcc pageXX.c -o pageXX `pkg-config --cflags --libs gtk+-3.0` */
